# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: 8.4 创建大量对象时节省内存方法.py
@time: 2021/02/11

slots 属性是节约内存的，不是用来约束对象添加属性的
"""


class Person:
    __slots__ = ['name', 'age']

    def __init__(self, name, age):
        self.name = name
        self.age = age


if __name__ == '__main__':
    pass
    person = Person('tongy', 21)
    print(vars(person.__class__))
